﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace QModel
{
    public class CommonReqEntity
    {
        #region Url

        private const string _qUrl = "";
        private const string _rrUrl = "http://api.renren.com/restserver.do";
        private const string _sinaUrl = "";
        private const string _tiyaUrl = "";

        #endregion

        #region Properties

        public string Url { get; set; }
        public Dictionary<string, object> Header { get; set; }
        public Dictionary<string, object> Body { get; set; }
        public HttpMethod ReqMethod { get; set; }
        public EncryptType EncryptType { get; set; }

        #endregion

        #region Constructor

        public CommonReqEntity(string url)
        {
            this.Url = url;
        }

        public CommonReqEntity(string url, Dictionary<string, object> header, Dictionary<string, object> paras, HttpMethod reqMethod,PlatformType platformType)
        {
            SetUrl(url, platformType);
            this.Header = header;
            this.Body = paras;
            this.ReqMethod = reqMethod;
            this.EncryptType = EncryptType.NONE;
        }

        public CommonReqEntity(string url, Dictionary<string, object> header, Dictionary<string, object> paras, HttpMethod reqMethod, EncryptType encryptType, PlatformType platformType)
        {
            SetUrl(url, platformType);
            this.Header = header;
            this.Body = paras;
            this.ReqMethod = reqMethod;
            this.EncryptType = encryptType;
        }


        private void SetUrl(string url, PlatformType platformType)
        {
            switch (platformType)
            {
                case PlatformType.RR:
                    this.Url = string.Concat(_rrUrl, url);
                    break;
                case PlatformType.QQ:
                    this.Url = string.Concat(_qUrl, url);
                    break;
                case PlatformType.SINA:
                    this.Url = string.Concat(_sinaUrl, url);
                    break;
                case PlatformType.TIYA:
                    this.Url = string.Concat(_tiyaUrl, url);
                    break;
                default:
                    this.Url = string.Concat(_rrUrl, url);
                    break;
            }
        }
        #endregion
    }
}
